/*************/
/* Variables */
/*************/

extern boolean OpWarning;

extern int currentsub;
extern int current_file_no;
extern int file_start_sym;
extern int temps_allocated;
extern int token_name;
extern int token_sym;
extern int user_files_pos;

extern char *fe_buffer;
extern char *ThisLine;

extern char **user_files;

int dup_globals_last;
int dup_globals_max;
int last_sym;
int lastint_extra;
int lastint_pos;
int literal_init;
int name_area_extra;
int name_area_pos;
int st_extra;
int st_pos;
int toplevelsub;

char *w_file;

char **name_area;

int *buckets;
int *lastintsym;
int *lastintval;

int *dup_globals;

long **symtab;


/************/
/* Routines */
/************/

extern int NewString(char *);


/***********/
/* Defines */
/***********/

#define ST_ROUTINE 19
#define ST_END -2
/* End of a symtab entry. */


/***********/
/* Structs */
/***********/

struct keys
{
    char *k_name;
    int k_scope;
    int k_token;
    int k_opcode;
    int k_num_args;
};

struct keys keylist[] = 
{
    {"if",               SC_KEYWORD, IF, 0, 0},
    {"end",              SC_KEYWORD, END, 0, 0},
    {"then",             SC_KEYWORD, THEN, 0, 0},
    {"procedure",        SC_KEYWORD, PROCEDURE, 0, 0},
    {"else",             SC_KEYWORD, ELSE, 0, 0},
    {"for",              SC_KEYWORD, FOR, 0, 0},
    {"return",           SC_KEYWORD, RETURN, 0, 0},
    {"do",               SC_KEYWORD, DO, 0, 0},
    {"elsif",            SC_KEYWORD, ELSIF, 0, 0},
    {"while",            SC_KEYWORD, WHILE, 0, 0},
    {"type",             SC_KEYWORD, TYPE_DECL, 0, 0},
    {"constant",         SC_KEYWORD, CONSTANT, 0, 0},
    {"to",               SC_KEYWORD, TO, 0, 0},
    {"and",              SC_KEYWORD, AND, 0, 0},
    {"or",               SC_KEYWORD, OR, 0, 0},
    {"exit",             SC_KEYWORD, EXIT, 0, 0},
    {"function",         SC_KEYWORD, FUNCTION, 0, 0},
    {"global",           SC_KEYWORD, GLOBAL, 0, 0},
    {"by",               SC_KEYWORD, BY, 0, 0},
    {"not",              SC_KEYWORD, NOT, 0, 0},
    {"include",          SC_KEYWORD, INCLUDE, 0, 0},
    {"with",             SC_KEYWORD, WITH, 0, 0},
    {"without",          SC_KEYWORD, WITHOUT, 0, 0},
    {"xor",              SC_KEYWORD, XOR, 0, 0},
    {"length",           SC_PREDEF, FUNC, LENGTH, 1},
    {"puts",             SC_PREDEF, PROC, PUTS, 2},
    {"integer",          SC_PREDEF, TYPE, IS_AN_INTEGER, 1},
    {"sequence",         SC_PREDEF, TYPE, IS_A_SEQUENCE, 1},
    {"position",         SC_PREDEF, PROC, POSITION, 2},
    {"object",           SC_PREDEF, TYPE, IS_AN_OBJECT, 1},
    {"append",           SC_PREDEF, FUNC, APPEND, 2},
    {"prepend",          SC_PREDEF, FUNC, PREPEND, 2},
    {"print",            SC_PREDEF, PROC, PRINT, 2},
    {"printf",           SC_PREDEF, PROC, PRINTF, 3},
    {"clear_screen",     SC_PREDEF, PROC, CLEAR_SCREEN, 0},
    {"floor",            SC_PREDEF, FUNC, FLOOR, 1},
    {"getc",             SC_PREDEF, FUNC, GETC, 1},
    {"gets",             SC_PREDEF, FUNC, GETS, 1},
    {"get_key",          SC_PREDEF, FUNC, GET_KEY, 0},
    {"rand",             SC_PREDEF, FUNC, RAND, 1},
    {"repeat",           SC_PREDEF, FUNC, REPEAT, 2},
    {"atom",             SC_PREDEF, TYPE, IS_AN_ATOM, 1},
    {"compare",          SC_PREDEF, FUNC, COMPARE, 2},
    {"find",             SC_PREDEF, FUNC, FIND, 2},
    {"match",            SC_PREDEF, FUNC, MATCH, 2},
    {"time",             SC_PREDEF, FUNC, TIME, 0},
    {"command_line",     SC_PREDEF, FUNC, COMMAND_LINE, 0},
    {"open",             SC_PREDEF, FUNC, OPEN, 2},
    {"close",            SC_PREDEF, PROC, CLOSE, 1},
    {"trace",            SC_PREDEF, PROC, TRACE, 1},
    {"getenv",           SC_PREDEF, FUNC, GETENV, 1},
    {"sqrt",             SC_PREDEF, FUNC, SQRT, 1},
    {"sin",              SC_PREDEF, FUNC, SIN, 1},
    {"cos",              SC_PREDEF, FUNC, COS, 1},
    {"tan",              SC_PREDEF, FUNC, TAN, 1},
    {"log",              SC_PREDEF, FUNC, LOG, 1},
    {"system",           SC_PREDEF, PROC, SYSTEM, 2},
    {"date",             SC_PREDEF, FUNC, DATE, 0}, 
    {"remainder",        SC_PREDEF, FUNC, REMAINDER, 2},
    {"power",            SC_PREDEF, FUNC, POWER, 2},
    {"machine_func",     SC_PREDEF, FUNC, MACHINE_FUNC, 2},
    {"machine_proc",     SC_PREDEF, PROC, MACHINE_PROC, 2},
    {"abort",            SC_PREDEF, PROC, ABORT, 1},
    {"peek",             SC_PREDEF, FUNC, PEEK, 1},
    {"poke",             SC_PREDEF, PROC, POKE, 2},
    {"call",             SC_PREDEF, PROC, CALL, 1},
    {"sprintf",          SC_PREDEF, FUNC, SPRINTF, 2},
    {"arctan",           SC_PREDEF, FUNC, ARCTAN, 1},
    {"and_bits",         SC_PREDEF, FUNC, AND_BITS, 2},
    {"or_bits",          SC_PREDEF, FUNC, OR_BITS, 2},
    {"xor_bits",         SC_PREDEF, FUNC, XOR_BITS, 2},
    {"not_bits",         SC_PREDEF, FUNC, NOT_BITS, 1},
    {"pixel",            SC_PREDEF, PROC, PIXEL, 2},
    {"get_pixel",        SC_PREDEF, FUNC, GET_PIXEL, 1},
    {"mem_copy",         SC_PREDEF, PROC, MEM_COPY, 3},
    {"mem_set",          SC_PREDEF, PROC, MEM_SET, 3},
    {"c_proc",           SC_PREDEF, PROC, C_PROC, 2}, 
    {"c_func",           SC_PREDEF, FUNC, C_FUNC, 2},
    {"routine_id",       SC_PREDEF, FUNC, ROUTINE_ID, 1},
    {"call_proc",        SC_PREDEF, PROC, CALL_PROC, 2},
    {"call_func",        SC_PREDEF, FUNC, CALL_FUNC, 2},
    {"poke4",            SC_PREDEF, PROC, POKE4, 2},
    {"peek4s",           SC_PREDEF, FUNC, PEEK4S, 1},
    {"peek4u",           SC_PREDEF, FUNC, PEEK4U, 1},
    {"profile",          SC_PREDEF, PROC, PROFILE, 1},
    {"equal",            SC_PREDEF, FUNC, EQUAL, 2},
    {"system_exec",      SC_PREDEF, FUNC, SYSTEM_EXEC, 2},
    {"platform",         SC_PREDEF, FUNC, PLATFORM, 0},
    {"task_create",      SC_PREDEF, FUNC, TASK_CREATE, 2},
    {"task_schedule",    SC_PREDEF, PROC, TASK_SCHEDULE, 2},
    {"task_yield",       SC_PREDEF, PROC, TASK_YIELD, 0},
    {"task_self",        SC_PREDEF, FUNC, TASK_SELF, 0},
    {"task_suspend",     SC_PREDEF, PROC, TASK_SUSPEND, 1},
    {"task_list",        SC_PREDEF, FUNC, TASK_LIST, 0},
    {"task_status",      SC_PREDEF, FUNC, TASK_STATUS, 1},
    {"task_clock_stop",  SC_PREDEF, PROC, TASK_CLOCK_STOP, 0},
    {"task_clock_start", SC_PREDEF, PROC, TASK_CLOCK_START, 0},
    {"_toplevel_",       SC_PREDEF, PROC, 0, 0}
};

#define NOVALUE      ((long)0xbfffffffL)

